home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!tsys.demon.co.uk
- From: Tom Wheeley <tomw@tsys.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: A question on for loop
- Date: Thu, 14 Mar 96 16:00:14 GMT
- Organization: City Zen FM
- Message-ID: <826819214snz@tsys.demon.co.uk>
- References: <31471574.79D9@hdc-usa.com> <4i77ca$161@ccshst05.cs.uoguelph.ca>
- Reply-To: tomw@tsys.demon.co.uk
- X-NNTP-Posting-Host: tsys.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.30
- X-Sig-By: Tomsystems Quote v1.2. (c)1996 Tom Wheeley, tomw@tsys.demon.co.uk
- X-Mail2News-Path: tsys.demon.co.uk
-
- In article <4i77ca$161@ccshst05.cs.uoguelph.ca>
- thay@uoguelph.ca "Toby K Hay" writes:
-
- > My novice's answer is yes, i starts off at 0 because the for statement
- > (i=0;i<20;i++) has i++ meaning that i is incremented after the
- > operation. If it were (i=0;i<20;++i) then i would start at 1 and run up
- > to 20. Is this correct?
-
- No. On their own, i++ and ++i are identical, the only difference being the
- return value. As that expression in the for loop discards the return value,
- it has no effect on the loop. The `before and after' effects you refer to
- are only effective with the expression, not the entire loop.
-
- .splitbung, likewise providing a novice's answer...
- --
- * TQ 1.0 * The 'Just So Quotes'.
- Trouble: Charles Manson. *REAL* Trouble: His evil twin.
- -- Mister Boffo
-